www.gusucode.com > Toyota Human Support Robot (HSR) Examples 程序工具箱matlab源码 > Toyota Human Support Robot (HSR) Examples/MATLAB_HSR_Examples/01_armControl/armControl_topic.m
% Example: Moving the arm using ROS topic % initialize ROS publisher pub = rospublisher('/hsrb/arm_trajectory_controller/command'); % fill ROS message traj = rosmessage(pub); traj.JointNames = {'arm_lift_joint', 'arm_flex_joint', ... 'arm_roll_joint', 'wrist_flex_joint', 'wrist_roll_joint'}; p1 = rosmessage('trajectory_msgs/JointTrajectoryPoint'); p1.Positions = [0.2, -0.5, 0, 0, 0]; p1.Velocities = [0, 0, 0, 0, 0]; p1.TimeFromStart = rosduration(3); p2 = rosmessage('trajectory_msgs/JointTrajectoryPoint'); p2.Positions = [0, 0, 0, 0, 0]; p2.Velocities = [0, 0, 0, 0, 0]; p2.TimeFromStart = rosduration(6); traj.Points = [p1; p2]; % publish ROS message send(pub,traj); % Copyright 2018 The MathWorks, Inc.